<?php

/**
 * This is the model class for table "kelompoktanihutanbinaan".
 *
 * The followings are the available columns in table 'kelompoktanihutanbinaan':
 * @property integer $kthb_id
 * @property integer $kthb_kec
 * @property integer $kthb_pemula
 * @property integer $kthb_madya
 * @property integer $kthb_lanjut
 * @property integer $kthb_jumlah
 * @property integer $kthb_anggota
 * @property integer $kthb_tahun
 *
 * The followings are the available model relations:
 * @property Kecamatan $kthbKec
 */
class Kelompoktanihutanbinaan extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Kelompoktanihutanbinaan the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'kelompoktanihutanbinaan';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('kthb_kec, kthb_pemula, kthb_madya, kthb_lanjut, kthb_jumlah, kthb_anggota, kthb_tahun', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('kthb_id, kthb_kec, kthb_pemula, kthb_madya, kthb_lanjut, kthb_jumlah, kthb_anggota, kthb_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'kthbKec' => array(self::BELONGS_TO, 'Kecamatan', 'kthb_kec'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'kthb_id' => 'Kthb',
			'kthb_kec' => 'Kthb Kec',
			'kthb_pemula' => 'Kthb Pemula',
			'kthb_madya' => 'Kthb Madya',
			'kthb_lanjut' => 'Kthb Lanjut',
			'kthb_jumlah' => 'Kthb Jumlah',
			'kthb_anggota' => 'Kthb Anggota',
			'kthb_tahun' => 'Kthb Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('kthb_id',$this->kthb_id);
		$criteria->compare('kthb_kec',$this->kthb_kec);
		$criteria->compare('kthb_pemula',$this->kthb_pemula);
		$criteria->compare('kthb_madya',$this->kthb_madya);
		$criteria->compare('kthb_lanjut',$this->kthb_lanjut);
		$criteria->compare('kthb_jumlah',$this->kthb_jumlah);
		$criteria->compare('kthb_anggota',$this->kthb_anggota);
		$criteria->compare('kthb_tahun',$this->kthb_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}